import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;


public class Main extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception {
        GridPane gridPane = new GridPane();
        Button a=new Button("开始游戏！");
        a.setLayoutX(0);
        a.setLayoutY(0);
        gridPane.add(a, 1 , 1);
        Scene q=new Scene(gridPane,300,300);

        Button s=new Button("结束游戏！");
        s.setLayoutX(600);
        s.setLayoutY(300);
        AnchorPane w=new AnchorPane();
        w.getChildren().addAll(s);

        Scene e=new Scene(w,500,500);
    primaryStage.setScene(q);
        primaryStage.setTitle("幸运");
        a.setOnAction(event -> {primaryStage.setScene(e);});
        s.setOnAction(event -> {primaryStage.setScene(q);});
        primaryStage.show();
    }

    public static void main(String[] args) {
        Application.launch(args);
    }
}





